$(document).ready(function() {
	mui.init();
	//订单数据
	function dmpay(type, result) {
		//获取收银员信息，并将数据渲染到页面
		
		
		
		mui.ajax(weburl + model5,{
			data:{
				"token": localStorage.getItem('token')
			},
			dataType:'json',//服务器返回json格式数据
			type:'post',//HTTP请求类型
			timeout:10000,//超时时间设置为10秒；
			headers:{'Content-Type':'application/json'},	              
			success:function(response){
				if (response.status=="success") {
					$(".account").html(response.data.id);
					$('.storeName').html(response.data.name);
					$('.phone').html(response.data.phone);
					if(response.data.merchant_type == 0) {
						$(".name").html("店长");
					} else {
						$(".name").html("收银员");
					}
				}
			},
			error:function(xhr,type,errorThrown){
				//异常处理；
				if(window.navigator.onLine==true){  
					mui.toast('没有该收银员信息',{ duration:'long', type:'div' });
				}else{  
					mui.toast('网络错误，请检查您的网络',{ duration:'long', type:'div' });
				} 
			}
		});
		
		//获取二维码
		mui.post(weburl + model_url, {
			"store_id": "o2088621605769851",
			"price": 0.01,
			"token": localStorage.getItem("token")
		}, function(response) {
			response = JSON.parse(response);
			//localStorage.setItem("codUrl","response.data.code_url");
			var qrcode = new QRCode(document.getElementById("qrcode"), {
	            width : 80,//设置宽高
	            height : 80
	        });
	        qrcode.makeCode(response.data.code_url);
		})
	}
	dmpay();
	
	var changePass = ["../view/updateCaozuoPass.html", "../view/updateLoginPass.html"];
	//点击密码或者操作密码跳转到对应页面
	mui("body").on("tap", ".change", function() {
		$(this).hasClass("operaPass") ? openWin(changePass[0], "operaPass") : openWin(changePass[1], "loginPass");
	})
	//跳转函数
	function openWin(urls, id) {
		mui.openWindow(urls, id);
	}

})